package com.water.devtool;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import com.watermud.util.PropertiesUtil;

public class ConfUtil {
	static Properties p;

	public static String getValue(String key) {
		if (p == null) {
			try {
				p = PropertiesUtil.loadConfigR("conf.properties");
			} catch (FileNotFoundException e) {
				e.printStackTrace();
				return null;
			} catch (IOException e) {
				e.printStackTrace();
				return null;
			}
		}
		return p.getProperty(key);
	}

	public static void reload() {
		p.clear();
		p = null;
	}

	public static Properties getProperties() {
		if (p == null) {
			try {
				p = PropertiesUtil.loadConfigR("conf.properties");
			} catch (FileNotFoundException e) {
				e.printStackTrace();
				return null;
			} catch (IOException e) {
				e.printStackTrace();
				return null;
			}
		}
		return p;
	}
}
